package com.shichenjia.fileupload.common;

public class ResultUtils {
    public static <T> BaseResponse<T> success(T data) {
        return new BaseResponse<>(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), data);
    }

    public static BaseResponse error(ErrorCode errorCode) {
        return new BaseResponse(errorCode);
    }

    public static BaseResponse error(int code, String msg) {
        return new BaseResponse(code, msg, null);
    }

    public static BaseResponse error(ErrorCode errorCode, String msg) {
        return new BaseResponse(errorCode.getCode(), msg, null);
    }
}
